package horde.utils.iconFactory;

import horde.internalResources.dictionaries.dictionary;
import javax.swing.Icon;
import javax.swing.ImageIcon;

/**
 * Simple Class that searches icons in a default route.
 * @author Arturo Mazón and Andres Picazo
 */
public class iconFactory {

    // <editor-fold defaultstate="collapsed" desc="Builder">
    public iconFactory () {

    }

    // </editor-fold>

    /**
     * Gets an Icon searched by its name in the dir /utils/iconFactory/icons
     * @param iconName Complete name of the picture
     * @return The Icon required
     * @exception Prints a message of warning if the icon is not found
     * @see Icon
     */
    public Icon getIcon (String iconName) {
        Icon i;
        try {
            i = new ImageIcon (getClass().getResource("icons/" + iconName));
            return i;
        }
        catch (Exception e) {
            System.err.println (dictionary.getString("ic.warning"));
            return null;
        }

    }
}
